﻿package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓


	//沙箱APPID
	public static final  String app_id = "2016092100565348";
	//沙箱私钥
	public static final  String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDWSax8avsrR/fsQCzRx0eALOCl6srccO1Cmowh4L2MHggBh8X7GZiRNm4/0x6nOgDr1GqD2IyZb0mYHUM5leXZllR8FLupZVHTPSc9GRqOnFEkpu8l2EqqqYNQ2Vo47SPKA0geVQnOPExiyYT87r1ufs7RONKfgiBrHK6edEdZSzb3UCBKJlrx5uz9lFQkBCn7VqDzXUsx3RVVv86F1++R1tcDH2ribTZKj27m6EBOd9ZNTvQOuv5IIqUVfIcLFX/Z/sZ6NUlj9eYdWuOWVYeRb64jPsIIXloQUoi4yFvIKyWAWTnyn85JpGoq5wbdrHmBnf5gUkum36aT7pRa1V8jAgMBAAECggEAAWwdw/mlzyS8JYpLgdzzwYsKtq83R31MZdvGwFbQi0SL ww7WppMF6zjURIIvOubsqKQRTOy8Ciyt7V+MWa6ABxCzYNt2X2p3v5IxV3t6LKYm 97pP7g1geX+Eip3WtngEe8vHx8PCu+a0jxdNVaxz/27CCqt44mwnsO5QzmZxLsuI5gZ4CeYRKP8JAzpAxh5XtkYYVJ2Ffqih5KZJ0RKEVPRtpzIyit31qdyiU49r2Ft0Vn2/QmwqtF0FNNy7b/CJryuD3IKMOJ6xqkVXXnRH8eG2QPyo9z01v4qeK1sOCI8t qoRsAbph51HpFutQpy1e0twloH0kkMkAqm18B1FO2QKBgQD1aDUz26SsDiYJsiodeV44dm4AgxjV8x/0f6KLh16It9q/C/bk+sLpY0jvMlKEAVPGThYXaf6bQFtxXuwSHsQ5xH8wIAw+NVeEolmX5ehFCtDXcWntOEWDRrqwkVJJwn+9qPEO3/l7MtT72puD9ZJMrPsSUbpqtDmxfGoVLRAZvwKBgQDfiZemLuLAgfJRMMabq8Gz86lNCosDjrNjK+3oJuKBpSkNAUA3mIKO687r4EhnGS0Ry2I0OyR6QjO9fhqUTpzS6KeWVmN2x64aSr5rABS/yCWG1cfpeE5mh3cO5pf5iDFzymhyyETZcYywU5aA2fbdPyxYjm89Yrfv isa6u/2rnQKBgQDi4fr9/L0bzODh6fQB1+mCLgu5MXrOor4SX8Y5VWfS4pe8NSWH wUZeW8pcSpv7Kvb2yc6myvn3MuLXx7hdcFBeUAp+xcJL6SkGmMpYIthArKUz6cjS5klt+wAyqcf4JXfQMtbat7uBaRd72ToaH/moJezhnOnKKOGF885n0YenJQKBgQCtYXtOWm9mAWSBtONXOxEzEnruVo8cY0KgWSJePkrRY9lDTQUSGiip0hzct0lxLgXX F3lEKdtROKgJAhZ7kb3xmKLj6H2dU6OmoPKw648scYEp5Ab6/2VQASJHXHPkB87T kNsSrGM6hOgqm6rQpj7jvGwZA+EkK72e/nTFwaovwQKBgDZHEjkHzqBL/cge8Ej/hwHruxgonPFkgC+baQqkEEARd0TddiKiHauRq5d0FB5E3cDRuVr43fZl6fIzxzbQEseQusM9yRYlRiScjkt3Qa25LtzW2LXr/XWfpXUSBUOzL8qTcmqM4z1tHwEiPADM jCJ/WoUjJ0LIKL2xIOB/VsxG";
	//支付宝公钥
	public static final  String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1kmsfGr7K0f37EAs0cdHgCzgperK3HDtQpqMIeC9jB4IAYfF+xmYkTZuP9MepzoA69Rqg9iMmW9JmB1DOZXl2ZZUfBS7qWVR0z0nPRkajpxRJKbvJdhKqqmDUNlaOO0jygNIHlUJzjxMYsmE/O69bn7O0TjSn4IgaxyunnRHWUs291AgSiZa8ebs/ZRUJAQp+1ag811LMd0VVb/OhdfvkdbXAx9q4m02So9u5uhATnfWTU70Drr+SCKlFXyHCxV/2f7GejVJY/XmHVrjllWHkW+uIz7CCF5aEFKIuMhbyCslgFk58p/OSaRqKucG3ax5gZ3+YFJLpt+mk+6UWtVf IwIDAQAB";
	//沙箱网关地址
	public static final  String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

//	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

//	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";

	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

